package b.f;

import b.f.g.b;
import b.f.g.c;
import b.f.g.e;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

/* compiled from: ArrayMap */
public class a<K, V> extends h<K, V> implements Map<K, V> {
    public g<K, V> h;

    /* compiled from: ArrayMap */
    public class a extends g<K, V> {
        public void a() {
            a.this.clear();
        }

        public Object b(int i, int i2) {
            return a.this.b[(i << 1) + i2];
        }

        public Map<K, V> c() {
            return a.this;
        }

        public int d() {
            return a.this.c;
        }

        public int e(Object obj) {
            return a.this.e(obj);
        }

        public int f(Object obj) {
            return a.this.g(obj);
        }

        public void g(K k, V v) {
            a.this.put(k, v);
        }

        public void h(int i) {
            a.this.i(i);
        }

        public V i(int i, V v) {
            i = (i << 1) + 1;
            Object[] objArr = a.this.b;
            V v2 = objArr[i];
            objArr[i] = v;
            return v2;
        }
    }

    public Set<Entry<K, V>> entrySet() {
        g l = l();
        if (l.a == null) {
            l.a = new b();
        }
        return l.a;
    }

    public Set<K> keySet() {
        g l = l();
        if (l.b == null) {
            l.b = new c();
        }
        return l.b;
    }

    public final g<K, V> l() {
        if (this.h == null) {
            this.h = new a();
        }
        return this.h;
    }

    public void putAll(Map<? extends K, ? extends V> map) {
        b(map.size() + this.c);
        for (Entry entry : map.entrySet()) {
            put(entry.getKey(), entry.getValue());
        }
    }

    public Collection<V> values() {
        g l = l();
        if (l.c == null) {
            l.c = new e();
        }
        return l.c;
    }

    public a(int i) {
        super(i);
    }

    public a(h hVar) {
        if (hVar != null) {
            int i = hVar.c;
            b(this.c + i);
            int i2 = 0;
            if (this.c != 0) {
                while (i2 < i) {
                    put(hVar.h(i2), hVar.k(i2));
                    i2++;
                }
            } else if (i > 0) {
                System.arraycopy(hVar.a, 0, this.a, 0, i);
                System.arraycopy(hVar.b, 0, this.b, 0, i << 1);
                this.c = i;
            }
        }
    }
}
